package com.blog.utils;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 将util包日期转化成sql包日期
 * @author Administrator
 *
 */
public class TimeUtils{

	
	public java.sql.Date time(Date date) {
		java.sql.Date sqlDate = new java.sql.Date(date.getTime());
		return sqlDate;
	}
	
	//将string类型时间换成sql的
	  public static java.sql.Date strToDate(String strDate) {  
	        String str = strDate;  
	        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");  
	        java.util.Date d = null;  
	        try {  
	            d = format.parse(str);  
	        } catch (Exception e) {  
	            e.printStackTrace();  
	        }  
	        java.sql.Date date = new java.sql.Date(d.getTime());  
	        return date;  
	    }  
	
}
